home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-17 | 6.5 KB | 250 lines | [TEXT/MPS ] |
- //
- // TMIntf.h
- // C Interface to the Terminal Manager
- //
- // Copyright © Apple Computer, Inc. 1988, 1989
- // All rights reserved.
- //
- //
-
- #ifndef __TMINTF__
- #define __TMINTF__
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __CTBUTILS__
- #include <CTBUtils.h>
- #endif
-
- #ifndef __CMINTF__
- #include <CMIntf.h>
- #endif
-
- // current Terminal Manager version
- #define curTMVersion 1
-
- // current Terminal Manager Environment Record version
-
- #define curTermEnvRecVers 0
-
- // error codes
- typedef OSErr TMErr;
-
- #define tmGenericError -1
- #define tmNoErr 0
- #define tmNotSupported 7
- #define tmNoTools 8
-
- // TMFlags
- typedef long TMFlags;
-
- enum {
- tmInvisible = 1 << 0,
- tmSaveBeforeClear = 1 << 1,
- tmNoMenus = 1 << 2,
- tmAutoScroll = 1 << 3
- };
-
- // TMSelTypes & TMSearchTypes
- typedef short TMSelTypes;
- typedef short TMSearchTypes;
-
- enum {
- selTextNormal = 1 << 0,
- selTextBoxed = 1 << 1,
- selGraphicsMarquee = 1 << 2,
- selGraphicsLasso = 1 << 3,
-
- tmSearchNoDiacrit = 1 << 8, // These are only for TMSearchTypes
- tmSearchNoCase = 1 << 9
- };
-
- // TMCursorTypes
- typedef short TMCursorTypes;
- enum {
- cursorText = 1,
- cursorGraphics = 2
- };
-
- // TMTermTypes
- typedef short TMTermTypes;
- enum {
- tmTextTerminal = 1 << 0,
- tmGraphicsTerminal = 1 << 1
- };
-
- struct TermDataBlock {
- TMTermTypes flags;
- Handle theData;
- Handle auxData;
- long reserved;
- };
-
- #ifndef __cplusplus
- typedef struct TermDataBlock TermDataBlock;
- #endif
-
- typedef TermDataBlock *TermDataBlockPtr, **TermDataBlockH;
-
- struct TermEnvironRec {
- short version;
- TMTermTypes termType;
- short textRows;
- short textCols;
- Point cellSize;
- Rect graphicSize;
- Point slop;
- Rect auxSpace;
- };
-
- #ifndef __cplusplus
- typedef struct TermEnvironRec TermEnvironRec;
- #endif
-
- typedef TermEnvironRec *TermEnvironPtr;
-
- union TMSelection {
- Rect selRect;
- RgnHandle selRgnHandle;
- };
-
- #ifndef __cplusplus
- typedef union TMSelection TMSelection;
- #endif
-
- struct TermRecord {
- short procID;
-
- TMFlags flags;
- TMErr errCode;
-
- long refCon;
- long userData;
-
- ProcPtr defProc;
-
- Ptr config;
- Ptr oldConfig;
-
- ProcPtr environsProc;
- long reserved1;
- long reserved2;
-
- Ptr tmPrivate;
-
- ProcPtr sendProc;
- ProcPtr breakProc;
- ProcPtr cacheProc;
- ProcPtr clikLoop;
-
- WindowPtr owner;
- Rect termRect;
- Rect viewRect;
- Rect visRect;
-
- long lastIdle;
-
- TMSelection selection;
- TMSelTypes selType;
-
- long mluField;
- };
-
- #ifndef __cplusplus
- typedef struct TermRecord TermRecord;
- #endif
-
- typedef TermRecord **TermHandle, *TermPointer;
-
- #ifdef __safe_link
- extern "C" {
- #endif
- extern pascal TMErr InitTM(void);
- extern pascal Handle TMGetVersion(TermHandle hTerm);
- extern pascal short TMGetTMVersion(void);
-
- extern pascal TermHandle TMNew(const Rect *termRect, const Rect *viewRect, TMFlags flags,
- short procID, WindowPtr owner, ProcPtr sendProc,
- ProcPtr cacheProc, ProcPtr breakProc, ProcPtr clikLoop, ProcPtr environsProc,
- long refCon, long userData);
-
- extern pascal void TMDispose(TermHandle hTerm);
-
- extern pascal void TMKey(TermHandle hTerm, const EventRecord *theEvent);
- extern pascal void TMUpdate(TermHandle hTerm, RgnHandle visRgn);
- extern pascal void TMPaint(TermHandle hTerm, const TermDataBlock *theTermData, const Rect *theRect);
- extern pascal void TMActivate(TermHandle hTerm, Boolean activate);
- extern pascal void TMResume(TermHandle hTerm, Boolean resume);
- extern pascal void TMClick(TermHandle hTerm, const EventRecord *theEvent);
- extern pascal void TMIdle(TermHandle hTerm);
-
- extern pascal long TMStream(TermHandle hTerm, Ptr theBuffer, long theLength, CMFlags flags);
- extern pascal Boolean TMMenu(TermHandle hTerm, short menuID, short item);
-
- extern pascal void TMReset(TermHandle hTerm);
- extern pascal void TMClear(TermHandle hTerm);
-
- extern pascal void TMResize(TermHandle hTerm, const Rect *newViewRect);
-
- extern pascal long TMGetSelect(TermHandle hTerm, Handle theData, ResType *theType);
- extern pascal void TMGetLine(TermHandle hTerm, short lineNo, TermDataBlock *theTermData);
- extern pascal void TMSetSelection(TermHandle hTerm, const TMSelection *theSelection, TMSelTypes selType);
-
- extern pascal void TMScroll(TermHandle hTerm, short dh, short dv);
-
-
- extern pascal Boolean TMValidate(TermHandle hTerm);
- extern pascal void TMDefault(Ptr *theConfig, short procID, Boolean allocate);
-
- extern pascal Handle TMSetupPreflight(short procID, long *magicCookie);
- extern pascal void TMSetupSetup(short procID, Ptr theConfig, short count,
- DialogPtr theDialog, long *magicCookie);
- extern pascal Boolean TMSetupFilter(short procID, Ptr theConfig, short count,
- DialogPtr theDialog, EventRecord *theEvent,
- short *theItem, long *magicCookie);
- extern pascal void TMSetupItem(short procID, Ptr theConfig, short count,
- DialogPtr theDialog, short *theItem, long *magicCookie);
- extern pascal void TMSetupCleanup(short procID, Ptr theConfig, short count,
- DialogPtr theDialog, long *magicCookie);
- extern pascal void TMSetupPostflight(short procID);
-
- extern pascal Ptr TMGetConfig(TermHandle hTerm);
- extern pascal short TMSetConfig(TermHandle hTerm, Ptr thePtr);
-
- extern pascal OSErr TMIntlToEnglish(TermHandle hTerm, Ptr inputPtr,
- Ptr *outputPtr, short language);
- extern pascal OSErr TMEnglishToIntl(TermHandle hTerm, Ptr inputPtr,
- Ptr *outputPtr, short language);
-
- extern pascal void TMGetToolName(short id, Str255 name);
- extern pascal short TMGetProcID(const Str255 name);
-
- extern pascal void TMSetRefCon(TermHandle hTerm, long refCon);
- extern pascal long TMGetRefCon(TermHandle hTerm);
-
- extern pascal void TMSetUserData(TermHandle hTerm, long userData);
- extern pascal long TMGetUserData(TermHandle hTerm);
-
- extern pascal short TMAddSearch(TermHandle hTerm, const Str255 theString, const Rect *where,
- TMSearchTypes searchType, ProcPtr callBack);
- extern pascal void TMRemoveSearch(TermHandle hTerm, short refnum);
- extern pascal void TMClearSearch(TermHandle hTerm);
-
- extern pascal Point TMGetCursor(TermHandle hTerm, TMCursorTypes cursType);
-
- extern pascal TMErr TMGetTermEnvirons(TermHandle hTerm, TermEnvironRec *theEnvirons);
-
- extern pascal short TMChoose(TermHandle *hTerm, Point where, ProcPtr idleProc);
- extern pascal void TMEvent(TermHandle hTerm, const EventRecord *theEvent);
-
- extern pascal Boolean TMDoTermKey(TermHandle hTerm, const Str255 theKey);
- extern pascal short TMCountTermKeys(TermHandle hTerm);
- extern pascal void TMGetIndTermKey(TermHandle hTerm, short id, Str255 theKey);
- #ifdef __safe_link
- }
- #endif
-
- #endif __TMINTF__
-